document.getElementsByTagName("html")[0].style.fontSize = document.body.clientWidth * 100 / 1440 + "px";

$("#wb").mouseover(()=>{
    $("#weibo").show();
}).mouseout(() => {
    $("#weibo").hide();
});

$("#wx").mouseover(()=>{
    $("#weixin").show();
}).mouseout(() => {
    $("#weixin").hide();
    });

$("#tixianAll").click(()=>{
    $("#text_je").val($("#text_ye").val());
});
let timer1 = null;
$(document).on('click','#J_getCode',(type)=>{
    if (type != 'editpwd') {
        if (!send()) {
            return;
        }
    }
    //验证码计时
    $("#J_getCode").hide();
    $("#J_resetCode").show();
    let i =60;
    timer1 = setInterval(()=>{
        i--;
        $("#J_second").html(i);
        if(i==0){
            $("#J_getCode").show();
            $("#J_resetCode").hide();
            clearInterval(timer1);
        }
    },1000);
});
//测试存储登录状态
if (sessionStorage.getItem("h") == "1") {
    $("#login").hide();
    $("#my").show();
}
//退出登录
$("#my").mouseover(() => {
    $("#logout").css({
        'display':'block',
        'position': 'absolute',
        'right': '.3rem',
        'top': '.6rem',
    });
})
//分页
if($('.box')[0]){
    $('.box').pagination({
        callback:function(api){
            $('.now').text(api.getCurrent());
        }
    },function(api){
        $('.now').text(api.getCurrent());
    });
}

//登录弹出框
$(document).on('click', '#login', () => {
    layer.close(layer.index);
    clearInterval(timer1);
    layer.open({
        type: 1,
        skin: 'login-style', //样式类名
        closeBtn: 0, //不显示关闭按钮
        anim: 2,
        shadeClose: true, //开启遮罩关闭
        title: false,
        area:['5.38rem','5rem'],
        content:
        '<section id="loginDiv">'+
            '<div class="logo"></div>' +
            '<div class="login_content">'+
                '<form>'+
                    '<div>'+
                        '<label for="phone"></label>'+
                        '<input id="phone" placeholder="手机号" type="text" maxlength="11" />'+
                    '</div>'+
                    '<div>'+
                        '<label for="password"></label>'+
                        '<input id="pass1" placeholder="密码(6-20位字符均可)" type="password" />'+
                    '</div>'+
                    '<submit id="reg-next">登录</submit>'+
                '</form>'+
                '<div class="foot">'+
                    '<a href="javascript:;" id="resetPwd"> 忘记密码 ?</a>'+
                    '<a href="javascript:" id="regist_btn">注册</a>'+
                '</div>'+
            '</div>'+
        '</section>'
    });
})
//登录
$(document).on('click', '#reg-next', () => {
    login();
});
//注册弹出框
$(document).on('click', '#regist_btn', () => {
    layer.close(layer.index);
    clearInterval(timer1);
    layer.open({
        type: 1,
        skin: 'login-style', //样式类名
        closeBtn: 0, //不显示关闭按钮
        anim: 2,
        shadeClose: true, //开启遮罩关闭
        title: false,
        area:['5.38rem','5.56rem'],
        content:
        '<section id="registerDiv">'+
        '<span class="reg_back"></span>'+
        '<div class="logo"></div>'+
        '<div class="login_content">'+
            '<form>'+
                '<div>'+
                    '<label for="phone"></label>'+
                    '<input type="text" id="phone" placeholder="手机号" maxlength="11" />'+
                '</div>'+
                '<div>'+
                    '<label for="code"></label>'+
                    '<input type="text" id="code" placeholder="验证码" maxlength="4" />'+
                    '<b id="J_getCode" onclick="sendValidCode(this, "reg")"></b>'+
                    '<p id="J_resetCode"><span id="J_second">60</span>秒后重发</p>'+
                '</div>'+
                '<div>'+
                    '<label for="code"></label>'+
                    '<input id="pass1" placeholder="密码(6-20位字符均可) " type="password" />'+
                '</div>'+
                '<submit id="reg-next2" onclick="regUser2(this);">注册</submit>'+
            '</form>'+
            '<div class="foot">'+
                '<input type="checkbox" checked="checked" id="agreement" />'+
                '<a href="http://jinfumeng.com/fumeng/template/agreement.html " target="_blank ">已阅读并同意《用户协议》</a>'+
                '<a href="javascript:;" id="login">已有账号登录</a>'+
            '</div>'+
        '</div>'+
    '</section>'
    });
})
//注册
$(document).on('click', '#reg-next2', () => {
    abc();
});
//忘记密码弹出框
$(document).on('click', '#resetPwd', () => {
    layer.close(layer.index);
    clearInterval(timer1);
    layer.open({
        type: 1,
        skin: 'login-style', //样式类名
        closeBtn: 0, //不显示关闭按钮
        anim: 2,
        shadeClose: true, //开启遮罩关闭
        title: false,
        area:['5.38rem','6.12rem'],
        content:
        '<section>'+
            '<div class="logo"></div>'+
            '<div class="login_content">'+
                '<form>'+
                    '<div>'+
                        '<label for="phone"></label>'+
                        '<input id="phone" placeholder="手机号" type="text" />'+
                    '</div>'+
                    '<div>'+
                        '<label for="code"></label>'+
                        '<input id="code" placeholder="验证码" type="text" maxlength="4" />'+
                        '<b id="J_getCode" onclick="sendValidCode(this,"forget")"></b>'+
                        '<p id="J_resetCode"><span id="J_second">60</span>秒后重发</p>'+
                    '</div>'+
                    '<div>'+
                        '<label for="password"></label>'+
                        '<input id="pass2" placeholder="新密码(6-20位字符均可)" type="password" maxlength="20" />'+
                    '</div>'+
                    '<div>'+
                        '<label for="password"></label>'+
                        '<input class="pass2" placeholder="确认密码(6-20位字符均可)" type="password" maxlength="20" />'+
                    '</div>'+
                    '<submit id="reg-next3">重置密码</submit>'+
                '</form>'+
            '</div>'+
        '</section>'
    });
})
//重置密码
$(document).on('click', '#reg-next3', () => {
    forget();
});



